$('document').ready(function() {
    $('#delete-multiple-items').click(function() {
        $('#delete-multiple-items-form').submit();
    });

    $('#search-item').click(function() {
        $('#search-bar').fadeIn(400, function() {
            $('#search-box-input').focus();
        });
    });

    $('#search-box-input').focusout(function() {
        $('#search-bar').fadeOut();
    });

    $('#search-box-input').keypress(function(e) {
        if (e.which === 13) {
            window.top.location = '/items?q='+$(this).val();
        }
    });
    
    $('.item-check-input').change(function() {
        if (this.checked == true) {
            $(this).parent().css('background-color', '#c02835');
        } else {
            $(this).parent().css('background-color', '#ffe3e2');
        }
    });
    
});

function view_item(url) {
    window.open(url, '', 'width=600,height=600');
}

function displayGenericErrorNotification() {
	$(document).ready(function() {
		jError("L'action n'a pas pu &ecirc;tre effectu&eacute;e. S'il vous pla&icirc;t essayer de nouveau.", {
				autoHide: true,
				clickOverlay: true,
				TimeShown: 2000,
				HorizontalPosition: 'center',
				VerticalPosition: 'center',
				onCompleted: function() {
				}
			}
		);
	});
}